package org.agile2soft.nexoma.tapestry.pages;

import org.apache.tapestry5.PersistenceConstants;
import org.apache.tapestry5.RenderSupport;
import org.apache.tapestry5.annotations.AfterRender;
import org.apache.tapestry5.annotations.IncludeJavaScriptLibrary;
import org.apache.tapestry5.annotations.Persist;
import org.apache.tapestry5.ioc.Messages;
import org.apache.tapestry5.ioc.annotations.Inject;

@IncludeJavaScriptLibrary("context:resources/js/Portal.js")
public class Portal {

    @Persist(PersistenceConstants.FLASH)
    private String messageCode;

    public String getMessageCode ( String message ) {
        return messageCode;
    }

    public void setMessageCode ( String messageCode ) {
        this.messageCode = messageCode;
    }

    @Inject
    private Messages _messages;

    public String getMessage() {
        return ( messageCode!=null ) ? _messages.get(messageCode) : null;
    }

    @Inject
    private RenderSupport _renderSupport;

    @AfterRender
    void afterRender() {
        _renderSupport.addInit("portalmanager","portalmanager");
    }


}
